﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace _046.线程池
{
	internal class Program
	{
		static void Main(string[] args)
		{
			for (int i = 0; i < 10; i++)
			{
				// 利用线程池创建的是后台线程
				ThreadPool.QueueUserWorkItem(DownLoad);
			}
			Thread.Sleep(5000);
		}

		static void DownLoad(object state)
		{
			for (int i = 0; i < 3; i++)
			{
				// 线程ID
                Console.WriteLine("DownLoading ..."+Thread.CurrentThread.ManagedThreadId);
				Thread.Sleep(100);
            }
		}
	}
}
